﻿@{
    ViewBag.Title = "补充案件信息";
    var provinceList = ServiceFactory.D_ProvinceServiceInstance.GetDProvinceAll();
    var selectList = new SelectList(provinceList, "ProvinceID", "ProvinceName");
}
@using ZBJF.Warranty.BLL
@using ZBJF.Warranty.Common.Enums.Certificate
@using ZBJF.Warranty.Common.Enums.InsuranceOrder
@model ZBJF.Warranty.Model.InsuranceWarrantyRecord

@using (Html.BeginForm("SaveInsuranceWarrantyRecord", "InsuranceWarrantyRecord", FormMethod.Post, new { id = "mvcForm", name = "mvcForm", @class = "form-horizontal", enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    @Html.HiddenFor(c => c.ID)
    @Html.HiddenFor(c => c.InsuranceOrderId)
    <h4>报案信息</h4>
    <table class="table table-responsive table-bordered table-hover">
        <tr>
            <th class="w120">报案人：</th>
            <td>@Html.TextBoxFor(m => m.Reporter, new { validate = "{required:true,messages:{required:'报案人必填！'}}", @class = "w-p98" })</td>
            <th class="w120">报案人手机：</th>
            <td>@Html.TextBoxFor(m => m.ReporterPhone, new { validate = "{required:true,isTelphone:true,messages:{required:'报案人手机必填！'}}", @class = "w-p98" })</td>
        </tr>
        <tr>
            <th>报案日期：</th>
            <td>@Html.TextBoxFor(m => m.CreateTime, new { Value = Model.CreateTime <= DateTime.MinValue ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : Model.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), validate = "{required:true,messages:{required:'报案日期必填！'}}", @readonly = "readonly", @class = "Wdate" })</td>
            <th>出险日期：</th>
            <td>@Html.TextBoxFor(m => m.ExpectAccidentDate, new { Value = Model.ExpectAccidentDate <= DateTime.MinValue ? DateTime.Now.ToString("yyyy-MM-dd") : Model.ExpectAccidentDate.ToString("yyyy-MM-dd"), validate = "{required:true,messages:{required:'出险日期必填！'}}", onclick = "WdatePicker({dateFmt:'yyyy-MM-dd'})", @class = "Wdate" })</td>
        </tr>
    </table>
    <h4>出险信息</h4>
    <table class="table table-responsive table-bordered table-hover">
        <tr>
            <th class="w120">被保险人（出险人）：</th>
            <td>@Html.DisplayFor(m => m.InsuranceOrder.UserName, new { @class = "w-p98" })</td>
            <th class="w120">出险地点：</th>
            <td class="w-p30">
                @Html.DropDownListFor(m => m.ProvinceId, selectList)
                @Html.DropDownListFor(m => m.CityId, new List<SelectListItem>())
            </td>
        </tr>
        <tr>
            <th>出险地点（详细地址）：</th>
            <td colspan="3">
                @Html.TextBoxFor(m => m.AccidentAddress, new { validate = "{required:false,messages:{required:'出险地点（详细地址）必填！'}}", @class = "w-p98" })
            </td>
        </tr>
        <tr>
            <th>出险经过说明：</th>
            <td colspan="3">
                @Html.TextAreaFor(m => m.AccidentProsess, new { validate = "{required:false,messages:{required:'出险经过说明必填！'}}", @class = "w-p98" })
            </td>
        </tr>
    </table>
    <h4>备注信息</h4>
    <div>
        @Html.TextAreaFor(m => m.Remark, new { @class = "w-p98" })
    </div>
    <div class="form-actions">
        <input id="btnAuditAndPass" class="btn btn-primary Edit-R"   type="submit" value="提交">
    </div>
}
@section scripts
{
    <script type="text/javascript">
        $(function () {
            provinceChange();
            $("#ProvinceId").change(function () {
                provinceChange();
            });
        });
        function provinceChange() {
            var provinceID = $("#ProvinceId").val();
            $.ajax({
                url: "/Common/GetCityList?provinceID=" + provinceID,
                success: function (data) {
                    var html = "";
                    $("#CityId").html(html);
                    if (data && data.length > 0) {
                        for (var i = 0; i < data.length; i++) {
                            html += "<option value='";
                            html += data[i].Value;
                            html += "'>" + data[i].Text;
                            html += "</option>";
                        }
                        $("#CityId").html(html);
                    }
                }
            });
        }
    </script>
}
